The following section describes four functions that let you display file previews.
The Movie Toolbox provides two functions that allow you to display file previews in an Open dialog box in System 6 using standard file reply structures: SFGetFilePreview and SFPGetFilePreview . The Movie Toolbox also supplies two new functions that allow you to display file previews in an Open dialog box in System 7 using standard file reply structures: StandardGetFilePreview and CustomGetFilePreview .
All of these functions take the same parameters as their existing counterparts with the addition of a where parameter that allows you to specify the location of the upper-left corner of the dialog box. See Inside Macintosh: Files for information on the SFGetFile , SFPGetFile , StandardGetFile , and CustomGetFile routines.
The SFGetFilePreview , SFPGetFilePreview , StandardGetFilePreview , and CustomGetFilePreview functions allow the user to automatically convert files to movies if your application requests movies. If there is a file that can be converted into a movie file using a movie import component, then the file is shown in the Standard File dialog box in addition to any movies. When the user selects the file, the Open button changes to a Convert button. Figure 38 provides an example of this dialog box.
Figure 41Dialog box showing automatic file-to-movie conversion option
Choosing Convert displays a dialog box that allows the user to choose where the converted file should be saved. Figure 39 shows this dialog box.
Figure 42Dialog box for saving a movie converted from a file
When conversion is complete, the converted file is returned to the calling application as the movie that the user chose. If you want to disable automatic file conversion in your application, you must write a file filter function and pass it to the file preview display function you are using. Your file filter function must call the File Manager's FSpGetFileInfo function on each file that is passed to it to determine its actual file type. If the File System parameter block pointer passed to your file filter function indicates that the file type is 'MooV' , and the actual type returned by FSpGetFileInfo is not 'MooV' , then the file filter function will convert this file. If you do not wish a file to be displayed as a candidate for conversion, your file filter function should return a value of true when it is called for that file.
See "File Filter Functions," for comprehensive details on the interaction of application-defined file filter functions with the file preview display functions. For information of FSpGetFileInfo , see Inside Macintosh: Files .
The functions described in this section do not appear in the MPW interface file Movies.h ; rather, they are listed in ImageCompression.h .
The SFGetFilePreview function allows you to display file previews in an Open dialog box using a standard file reply structure. This is the preferred function for displaying a file preview and it works with either System 7 or System 6.
pascal void SFGetFilePreview (Point where,
ConstStr255Param prompt,
FileFilterUPP fileFilter,
short numTypes,
ConstSFTypeListPtr typeList,
DlgHookUPP dlgHook,
SFReply *reply);
pascal Boolean MyFileFilter (ParmBlkPtr parmBlock);
typedef OSType ConstSFTypeListPtr[4];
pascal short MyDlgHook (short item,
DialogPtr theDialog,
Ptr myDataPtr);
The SFGetFilePreview function presents an Open dialog box to the user and allows the user to view file previews during the dialog. This function corresponds to the File Manager's SFGetFile routine. See Inside Macintosh: Files for a complete description of the SFGetFile routine.
The SFGetFilePreview function takes the same parameters as its existing counterpart with the addition of a where parameter that allows you to specify the location of the dialog box.
The SFGetFilePreview function automatically converts files to movies if your application requests movies. If a file could be converted into a movie file using a movie import component, then the file is shown in the Standard File dialog box. See Figure 38 for the dialog box with an automatic file-to-movie conversion option and Figure 39 for the dialog box for saving a movie converted from a file.
The SFGetFilePreview function does not appear in the MPW interface file Movies.h ; rather, it's listed in ImageCompression.h .
The SFPGetFilePreview function allows you to display file previews in an Open dialog box using a standard file reply structure. This function differs from SFGetFilePreview in that you can provide a custom dialog box with any resource type and you can specify a modal-dialog filter function that allows you to gain greater control over the user interface.
pascal void SFPGetFilePreview (Point where,
ConstStr255Param prompt,
FileFilterUPP fileFilter,
short numTypes,
ConstSFTypeListPtr typeList,
DlgHookUPP dlgHook,
SFReply *reply, short dlgID,
ModalFilterUPP filterProc);
pascal Boolean MyFileFilter (ParmBlkPtr parmBlock);
typedef OSType ConstSFTypeListPtr[4];
pascal short MyDlgHook (short item,
DialogPtr theDialog,
Ptr myDataPtr);
pascal Boolean MyModalFilter (DialogPtr theDialog,
EventRecord* theEvent,
short itemHit,
Ptr myDataPtr);
The SFPGetFilePreview function presents an Open dialog box to the user and allows the user to view file previews during the dialog. This function corresponds to the File Manager's SFPGetFile routine. The SFPGetFilePreview function takes the same parameters as its existing counterpart with the addition of a where parameter that allows you to specify the location of the dialog box. See Inside Macintosh: Files for a complete description of the SFPGetFile routine and for more information about the parameters to this function.
The SFPGetFilePreview function automatically converts files to movies if your application requests movies. If a file could be converted into a movie file using a movie import component, then the file is shown in the Standard File dialog box. See Figure 38 for the dialog box with an automatic file-to-movie conversion option and Figure 39 for the dialog box for saving a movie converted from a file.
The SFPGetFilePreview function does not appear in the MPW interface file Movies.h ; rather, it's listed in ImageCompression.h .
The SFPGetFilePreview function allows you to display file previews in an Open dialog box using a standard file reply structure.
pascal void StandardGetFilePreview (FileFilterUPP fileFilter,
short numTypes,
ConstSFTypeListPtr typeList,
StandardFileReply *reply);
pascal Boolean MyFileFilter (ParmBlkPtr parmBlock);
typedef OSType ConstSFTypeListPtr[4];
The StandardGetFilePreview function presents an Open dialog box to the user and allows the user to view file previews. This function corresponds to the File Manager's StandardGetFile routine. See Inside Macintosh: Files for a comprehensive description of that routine and for more information about the parameters to this function. The StandardGetFilePreview function takes the same parameters as its existing counterpart with the addition of a where parameter that allows you to specify the location of the dialog box.
The StandardGetFilePreview function automatically converts files to movies if your application requests movies. If a file could be converted into a movie file using a movie import component, then the file is shown in the Standard File dialog box. See Figure 38 for the dialog box with an automatic file-to-movie conversion option and Figure 39 for the dialog box for saving a movie converted from a file.
The StandardGetFilePreview function does not appear in the MPW interface file Movies.h ; rather, it's listed in ImageCompression.h .
The CustomGetFilePreview function presents an Open dialog box to the user and allows the user to view file previews. This function differs from StandardGetFilePreview in that you can provide a custom dialog template and functions to support your template.
The CustomGetFilePreview function is available only in System 7.
pascal void CustomGetFilePreview (FileFilterYDUPP fileFilter,
short numTypes,
ConstSFTypeListPtr typeList,
StandardFileReply *reply,
short dlgID,
Point where,
DlgHookYDUPP dlgHook,
ModalFilterYDUPP filterProc,
ActivationOrderListPtr activeList,
ActivateYDUPP activateProc,
void *yourDataPtr);
pascal Boolean MyFileFilter (ParmBlkPtr parmBlock);
typedef OSType ConstSFTypeListPtr[4];
pascal short MyDlgHook (short item, DialogPtr
theDialog, Ptr myDataPtr);
pascal Boolean MyModalFilter (DialogPtr theDialog,
EventRecord* theEvent,
short itemHit,
Ptr myDataPtr);
pascal void MyActivateProc (DialogPtr theDialog,
short itemNo,
Boolean activating,
Ptr myDataPtr);
The CustomGetFilePreview function is available only if the value of the Gestalt selector gestaltStandardFileAttr is true . (See Inside Macintosh: Overview for more information about this selector.) This function corresponds to the File Manager's CustomGetFile routine. The CustomGetFilePreview function takes the same parameters as its existing counterpart with the addition of a where parameter that allows you to specify the location of the dialog box. See Inside Macintosh: Files for a complete description of the CustomGetFile routine and for more information about the parameters to this function.
The CustomGetFilePreview function automatically converts files to movies if your application requests movies. If a file could be converted into a movie file using a movie import component, then the file is shown in the Standard File dialog box. See Figure 38 for the dialog box with an automatic file-to-movie conversion option and Figure 39 for the dialog box for saving a movie converted from a file.
The CustomGetFilePreview function does not appear in the MPW interface file Movies.h ; rather, it's listed in ImageCompression.h .